(0) Obligation:

Runtime Complexity TRS:
The TRS R consists of the following rules:

nonZero(0) → false
nonZero(s(x)) → true
p(0) → 0
p(s(x)) → x
id_inc(x) → x
id_inc(x) → s(x)
random(x) → rand(x, 0)
rand(x, y) → if(nonZero(x), x, y)
if(false, x, y) → y
if(true, x, y) → rand(p(x), id_inc(y))

Rewrite Strategy: INNERMOST

(1) CpxTrsToCdtProof (BOTH BOUNDS(ID, ID) transformation)

Converted CpxTRS to CDT

(2) Obligation:

Complexity Dependency Tuples Problem
Rules:

nonZero(0) → false
nonZero(s(z0)) → true
p(0) → 0
p(s(z0)) → z0
id_inc(z0) → z0
id_inc(z0) → s(z0)
random(z0) → rand(z0, 0)
rand(z0, z1) → if(nonZero(z0), z0, z1)
if(false, z0, z1) → z1
if(true, z0, z1) → rand(p(z0), id_inc(z1))
Tuples:

RANDOM(z0) → c6(RAND(z0, 0))
RAND(z0, z1) → c7(IF(nonZero(z0), z0, z1), NONZERO(z0))
IF(true, z0, z1) → c9(RAND(p(z0), id_inc(z1)), P(z0), ID_INC(z1))
S tuples:

RANDOM(z0) → c6(RAND(z0, 0))
RAND(z0, z1) → c7(IF(nonZero(z0), z0, z1), NONZERO(z0))
IF(true, z0, z1) → c9(RAND(p(z0), id_inc(z1)), P(z0), ID_INC(z1))
K tuples:none
Defined Rule Symbols:

nonZero, p, id_inc, random, rand, if

Defined Pair Symbols:

RANDOM, RAND, IF

Compound Symbols:

c6, c7, c9

(3) CdtLeafRemovalProof (ComplexityIfPolyImplication transformation)

Removed 1 leading nodes:

RANDOM(z0) → c6(RAND(z0, 0))

(4) Obligation:

Complexity Dependency Tuples Problem
Rules:

nonZero(0) → false
nonZero(s(z0)) → true
p(0) → 0
p(s(z0)) → z0
id_inc(z0) → z0
id_inc(z0) → s(z0)
random(z0) → rand(z0, 0)
rand(z0, z1) → if(nonZero(z0), z0, z1)
if(false, z0, z1) → z1
if(true, z0, z1) → rand(p(z0), id_inc(z1))
Tuples:

RAND(z0, z1) → c7(IF(nonZero(z0), z0, z1), NONZERO(z0))
IF(true, z0, z1) → c9(RAND(p(z0), id_inc(z1)), P(z0), ID_INC(z1))
S tuples:

RAND(z0, z1) → c7(IF(nonZero(z0), z0, z1), NONZERO(z0))
IF(true, z0, z1) → c9(RAND(p(z0), id_inc(z1)), P(z0), ID_INC(z1))
K tuples:none
Defined Rule Symbols:

nonZero, p, id_inc, random, rand, if

Defined Pair Symbols:

RAND, IF

Compound Symbols:

c7, c9

(5) CdtNarrowingProof (BOTH BOUNDS(ID, ID) transformation)

Use narrowing to replace RAND(z0, z1) → c7(IF(nonZero(z0), z0, z1), NONZERO(z0)) by

RAND(0, x1) → c7(IF(false, 0, x1), NONZERO(0))
RAND(s(z0), x1) → c7(IF(true, s(z0), x1), NONZERO(s(z0)))
RAND(x0, x1) → c7

(6) Obligation:

Complexity Dependency Tuples Problem
Rules:

nonZero(0) → false
nonZero(s(z0)) → true
p(0) → 0
p(s(z0)) → z0
id_inc(z0) → z0
id_inc(z0) → s(z0)
random(z0) → rand(z0, 0)
rand(z0, z1) → if(nonZero(z0), z0, z1)
if(false, z0, z1) → z1
if(true, z0, z1) → rand(p(z0), id_inc(z1))
Tuples:

IF(true, z0, z1) → c9(RAND(p(z0), id_inc(z1)), P(z0), ID_INC(z1))
RAND(0, x1) → c7(IF(false, 0, x1), NONZERO(0))
RAND(s(z0), x1) → c7(IF(true, s(z0), x1), NONZERO(s(z0)))
RAND(x0, x1) → c7
S tuples:

IF(true, z0, z1) → c9(RAND(p(z0), id_inc(z1)), P(z0), ID_INC(z1))
RAND(0, x1) → c7(IF(false, 0, x1), NONZERO(0))
RAND(s(z0), x1) → c7(IF(true, s(z0), x1), NONZERO(s(z0)))
RAND(x0, x1) → c7
K tuples:none
Defined Rule Symbols:

nonZero, p, id_inc, random, rand, if

Defined Pair Symbols:

IF, RAND

Compound Symbols:

c9, c7, c7

(7) CdtLeafRemovalProof (BOTH BOUNDS(ID, ID) transformation)

Removed 2 trailing nodes:

RAND(x0, x1) → c7
RAND(0, x1) → c7(IF(false, 0, x1), NONZERO(0))

(8) Obligation:

Complexity Dependency Tuples Problem
Rules:

nonZero(0) → false
nonZero(s(z0)) → true
p(0) → 0
p(s(z0)) → z0
id_inc(z0) → z0
id_inc(z0) → s(z0)
random(z0) → rand(z0, 0)
rand(z0, z1) → if(nonZero(z0), z0, z1)
if(false, z0, z1) → z1
if(true, z0, z1) → rand(p(z0), id_inc(z1))
Tuples:

IF(true, z0, z1) → c9(RAND(p(z0), id_inc(z1)), P(z0), ID_INC(z1))
RAND(s(z0), x1) → c7(IF(true, s(z0), x1), NONZERO(s(z0)))
S tuples:

IF(true, z0, z1) → c9(RAND(p(z0), id_inc(z1)), P(z0), ID_INC(z1))
RAND(s(z0), x1) → c7(IF(true, s(z0), x1), NONZERO(s(z0)))
K tuples:none
Defined Rule Symbols:

nonZero, p, id_inc, random, rand, if

Defined Pair Symbols:

IF, RAND

Compound Symbols:

c9, c7

(9) CdtNarrowingProof (BOTH BOUNDS(ID, ID) transformation)

Use narrowing to replace IF(true, z0, z1) → c9(RAND(p(z0), id_inc(z1)), P(z0), ID_INC(z1)) by

IF(true, x0, z0) → c9(RAND(p(x0), z0), P(x0), ID_INC(z0))
IF(true, x0, z0) → c9(RAND(p(x0), s(z0)), P(x0), ID_INC(z0))
IF(true, 0, x1) → c9(RAND(0, id_inc(x1)), P(0), ID_INC(x1))
IF(true, s(z0), x1) → c9(RAND(z0, id_inc(x1)), P(s(z0)), ID_INC(x1))
IF(true, x0, x1) → c9

(10) Obligation:

Complexity Dependency Tuples Problem
Rules:

nonZero(0) → false
nonZero(s(z0)) → true
p(0) → 0
p(s(z0)) → z0
id_inc(z0) → z0
id_inc(z0) → s(z0)
random(z0) → rand(z0, 0)
rand(z0, z1) → if(nonZero(z0), z0, z1)
if(false, z0, z1) → z1
if(true, z0, z1) → rand(p(z0), id_inc(z1))
Tuples:

RAND(s(z0), x1) → c7(IF(true, s(z0), x1), NONZERO(s(z0)))
IF(true, x0, z0) → c9(RAND(p(x0), z0), P(x0), ID_INC(z0))
IF(true, x0, z0) → c9(RAND(p(x0), s(z0)), P(x0), ID_INC(z0))
IF(true, 0, x1) → c9(RAND(0, id_inc(x1)), P(0), ID_INC(x1))
IF(true, s(z0), x1) → c9(RAND(z0, id_inc(x1)), P(s(z0)), ID_INC(x1))
IF(true, x0, x1) → c9
S tuples:

RAND(s(z0), x1) → c7(IF(true, s(z0), x1), NONZERO(s(z0)))
IF(true, x0, z0) → c9(RAND(p(x0), z0), P(x0), ID_INC(z0))
IF(true, x0, z0) → c9(RAND(p(x0), s(z0)), P(x0), ID_INC(z0))
IF(true, 0, x1) → c9(RAND(0, id_inc(x1)), P(0), ID_INC(x1))
IF(true, s(z0), x1) → c9(RAND(z0, id_inc(x1)), P(s(z0)), ID_INC(x1))
IF(true, x0, x1) → c9
K tuples:none
Defined Rule Symbols:

nonZero, p, id_inc, random, rand, if

Defined Pair Symbols:

RAND, IF

Compound Symbols:

c7, c9, c9

(11) CdtLeafRemovalProof (BOTH BOUNDS(ID, ID) transformation)

Removed 2 trailing nodes:

IF(true, x0, x1) → c9
IF(true, 0, x1) → c9(RAND(0, id_inc(x1)), P(0), ID_INC(x1))

(12) Obligation:

Complexity Dependency Tuples Problem
Rules:

nonZero(0) → false
nonZero(s(z0)) → true
p(0) → 0
p(s(z0)) → z0
id_inc(z0) → z0
id_inc(z0) → s(z0)
random(z0) → rand(z0, 0)
rand(z0, z1) → if(nonZero(z0), z0, z1)
if(false, z0, z1) → z1
if(true, z0, z1) → rand(p(z0), id_inc(z1))
Tuples:

RAND(s(z0), x1) → c7(IF(true, s(z0), x1), NONZERO(s(z0)))
IF(true, x0, z0) → c9(RAND(p(x0), z0), P(x0), ID_INC(z0))
IF(true, x0, z0) → c9(RAND(p(x0), s(z0)), P(x0), ID_INC(z0))
IF(true, s(z0), x1) → c9(RAND(z0, id_inc(x1)), P(s(z0)), ID_INC(x1))
S tuples:

RAND(s(z0), x1) → c7(IF(true, s(z0), x1), NONZERO(s(z0)))
IF(true, x0, z0) → c9(RAND(p(x0), z0), P(x0), ID_INC(z0))
IF(true, x0, z0) → c9(RAND(p(x0), s(z0)), P(x0), ID_INC(z0))
IF(true, s(z0), x1) → c9(RAND(z0, id_inc(x1)), P(s(z0)), ID_INC(x1))
K tuples:none
Defined Rule Symbols:

nonZero, p, id_inc, random, rand, if

Defined Pair Symbols:

RAND, IF

Compound Symbols:

c7, c9

(13) CdtPolyRedPairProof (UPPER BOUND (ADD(O(n^1))) transformation)

Found a reduction pair which oriented the following tuples strictly. Hence they can be removed from S.

IF(true, s(z0), x1) → c9(RAND(z0, id_inc(x1)), P(s(z0)), ID_INC(x1))
We considered the (Usable) Rules:

id_inc(z0) → z0
id_inc(z0) → s(z0)
p(0) → 0
p(s(z0)) → z0
And the Tuples:

RAND(s(z0), x1) → c7(IF(true, s(z0), x1), NONZERO(s(z0)))
IF(true, x0, z0) → c9(RAND(p(x0), z0), P(x0), ID_INC(z0))
IF(true, x0, z0) → c9(RAND(p(x0), s(z0)), P(x0), ID_INC(z0))
IF(true, s(z0), x1) → c9(RAND(z0, id_inc(x1)), P(s(z0)), ID_INC(x1))
The order we found is given by the following interpretation:
Polynomial interpretation :

POL(0) = [3]   
POL(ID_INC(x1)) = 0   
POL(IF(x1, x2, x3)) = [2]x2   
POL(NONZERO(x1)) = 0   
POL(P(x1)) = 0   
POL(RAND(x1, x2)) = [2]x1   
POL(c7(x1, x2)) = x1 + x2   
POL(c9(x1, x2, x3)) = x1 + x2 + x3   
POL(id_inc(x1)) = [5] + [2]x1   
POL(p(x1)) = x1   
POL(s(x1)) = [4] + x1   
POL(true) = [2]   

(14) Obligation:

Complexity Dependency Tuples Problem
Rules:

nonZero(0) → false
nonZero(s(z0)) → true
p(0) → 0
p(s(z0)) → z0
id_inc(z0) → z0
id_inc(z0) → s(z0)
random(z0) → rand(z0, 0)
rand(z0, z1) → if(nonZero(z0), z0, z1)
if(false, z0, z1) → z1
if(true, z0, z1) → rand(p(z0), id_inc(z1))
Tuples:

RAND(s(z0), x1) → c7(IF(true, s(z0), x1), NONZERO(s(z0)))
IF(true, x0, z0) → c9(RAND(p(x0), z0), P(x0), ID_INC(z0))
IF(true, x0, z0) → c9(RAND(p(x0), s(z0)), P(x0), ID_INC(z0))
IF(true, s(z0), x1) → c9(RAND(z0, id_inc(x1)), P(s(z0)), ID_INC(x1))
S tuples:

RAND(s(z0), x1) → c7(IF(true, s(z0), x1), NONZERO(s(z0)))
IF(true, x0, z0) → c9(RAND(p(x0), z0), P(x0), ID_INC(z0))
IF(true, x0, z0) → c9(RAND(p(x0), s(z0)), P(x0), ID_INC(z0))
K tuples:

IF(true, s(z0), x1) → c9(RAND(z0, id_inc(x1)), P(s(z0)), ID_INC(x1))
Defined Rule Symbols:

nonZero, p, id_inc, random, rand, if

Defined Pair Symbols:

RAND, IF

Compound Symbols:

c7, c9

(15) CdtNarrowingProof (BOTH BOUNDS(ID, ID) transformation)

Use narrowing to replace RAND(s(z0), x1) → c7(IF(true, s(z0), x1), NONZERO(s(z0))) by

RAND(s(x0), x1) → c7(IF(true, s(x0), x1))

(16) Obligation:

Complexity Dependency Tuples Problem
Rules:

nonZero(0) → false
nonZero(s(z0)) → true
p(0) → 0
p(s(z0)) → z0
id_inc(z0) → z0
id_inc(z0) → s(z0)
random(z0) → rand(z0, 0)
rand(z0, z1) → if(nonZero(z0), z0, z1)
if(false, z0, z1) → z1
if(true, z0, z1) → rand(p(z0), id_inc(z1))
Tuples:

IF(true, x0, z0) → c9(RAND(p(x0), z0), P(x0), ID_INC(z0))
IF(true, x0, z0) → c9(RAND(p(x0), s(z0)), P(x0), ID_INC(z0))
IF(true, s(z0), x1) → c9(RAND(z0, id_inc(x1)), P(s(z0)), ID_INC(x1))
RAND(s(x0), x1) → c7(IF(true, s(x0), x1))
S tuples:

IF(true, x0, z0) → c9(RAND(p(x0), z0), P(x0), ID_INC(z0))
IF(true, x0, z0) → c9(RAND(p(x0), s(z0)), P(x0), ID_INC(z0))
RAND(s(x0), x1) → c7(IF(true, s(x0), x1))
K tuples:

IF(true, s(z0), x1) → c9(RAND(z0, id_inc(x1)), P(s(z0)), ID_INC(x1))
Defined Rule Symbols:

nonZero, p, id_inc, random, rand, if

Defined Pair Symbols:

IF, RAND

Compound Symbols:

c9, c7

(17) CdtNarrowingProof (BOTH BOUNDS(ID, ID) transformation)

Use narrowing to replace IF(true, x0, z0) → c9(RAND(p(x0), z0), P(x0), ID_INC(z0)) by

IF(true, 0, x1) → c9(RAND(0, x1), P(0), ID_INC(x1))
IF(true, s(z0), x1) → c9(RAND(z0, x1), P(s(z0)), ID_INC(x1))
IF(true, x0, x1) → c9

(18) Obligation:

Complexity Dependency Tuples Problem
Rules:

nonZero(0) → false
nonZero(s(z0)) → true
p(0) → 0
p(s(z0)) → z0
id_inc(z0) → z0
id_inc(z0) → s(z0)
random(z0) → rand(z0, 0)
rand(z0, z1) → if(nonZero(z0), z0, z1)
if(false, z0, z1) → z1
if(true, z0, z1) → rand(p(z0), id_inc(z1))
Tuples:

IF(true, x0, z0) → c9(RAND(p(x0), s(z0)), P(x0), ID_INC(z0))
IF(true, s(z0), x1) → c9(RAND(z0, id_inc(x1)), P(s(z0)), ID_INC(x1))
RAND(s(x0), x1) → c7(IF(true, s(x0), x1))
IF(true, 0, x1) → c9(RAND(0, x1), P(0), ID_INC(x1))
IF(true, s(z0), x1) → c9(RAND(z0, x1), P(s(z0)), ID_INC(x1))
IF(true, x0, x1) → c9
S tuples:

IF(true, x0, z0) → c9(RAND(p(x0), s(z0)), P(x0), ID_INC(z0))
RAND(s(x0), x1) → c7(IF(true, s(x0), x1))
IF(true, 0, x1) → c9(RAND(0, x1), P(0), ID_INC(x1))
IF(true, s(z0), x1) → c9(RAND(z0, x1), P(s(z0)), ID_INC(x1))
IF(true, x0, x1) → c9
K tuples:

IF(true, s(z0), x1) → c9(RAND(z0, id_inc(x1)), P(s(z0)), ID_INC(x1))
Defined Rule Symbols:

nonZero, p, id_inc, random, rand, if

Defined Pair Symbols:

IF, RAND

Compound Symbols:

c9, c7, c9

(19) CdtLeafRemovalProof (BOTH BOUNDS(ID, ID) transformation)

Removed 2 trailing nodes:

IF(true, x0, x1) → c9
IF(true, 0, x1) → c9(RAND(0, x1), P(0), ID_INC(x1))

(20) Obligation:

Complexity Dependency Tuples Problem
Rules:

nonZero(0) → false
nonZero(s(z0)) → true
p(0) → 0
p(s(z0)) → z0
id_inc(z0) → z0
id_inc(z0) → s(z0)
random(z0) → rand(z0, 0)
rand(z0, z1) → if(nonZero(z0), z0, z1)
if(false, z0, z1) → z1
if(true, z0, z1) → rand(p(z0), id_inc(z1))
Tuples:

IF(true, x0, z0) → c9(RAND(p(x0), s(z0)), P(x0), ID_INC(z0))
IF(true, s(z0), x1) → c9(RAND(z0, id_inc(x1)), P(s(z0)), ID_INC(x1))
RAND(s(x0), x1) → c7(IF(true, s(x0), x1))
IF(true, s(z0), x1) → c9(RAND(z0, x1), P(s(z0)), ID_INC(x1))
S tuples:

IF(true, x0, z0) → c9(RAND(p(x0), s(z0)), P(x0), ID_INC(z0))
RAND(s(x0), x1) → c7(IF(true, s(x0), x1))
IF(true, s(z0), x1) → c9(RAND(z0, x1), P(s(z0)), ID_INC(x1))
K tuples:

IF(true, s(z0), x1) → c9(RAND(z0, id_inc(x1)), P(s(z0)), ID_INC(x1))
Defined Rule Symbols:

nonZero, p, id_inc, random, rand, if

Defined Pair Symbols:

IF, RAND

Compound Symbols:

c9, c7

(21) CdtPolyRedPairProof (UPPER BOUND (ADD(O(n^1))) transformation)

Found a reduction pair which oriented the following tuples strictly. Hence they can be removed from S.

IF(true, s(z0), x1) → c9(RAND(z0, x1), P(s(z0)), ID_INC(x1))
We considered the (Usable) Rules:

id_inc(z0) → z0
id_inc(z0) → s(z0)
p(0) → 0
p(s(z0)) → z0
And the Tuples:

IF(true, x0, z0) → c9(RAND(p(x0), s(z0)), P(x0), ID_INC(z0))
IF(true, s(z0), x1) → c9(RAND(z0, id_inc(x1)), P(s(z0)), ID_INC(x1))
RAND(s(x0), x1) → c7(IF(true, s(x0), x1))
IF(true, s(z0), x1) → c9(RAND(z0, x1), P(s(z0)), ID_INC(x1))
The order we found is given by the following interpretation:
Polynomial interpretation :

POL(0) = [3]   
POL(ID_INC(x1)) = 0   
POL(IF(x1, x2, x3)) = [5]x1 + [4]x2   
POL(P(x1)) = 0   
POL(RAND(x1, x2)) = [4]x1   
POL(c7(x1)) = x1   
POL(c9(x1, x2, x3)) = x1 + x2 + x3   
POL(id_inc(x1)) = [5] + [2]x1   
POL(p(x1)) = x1   
POL(s(x1)) = [4] + x1   
POL(true) = 0   

(22) Obligation:

Complexity Dependency Tuples Problem
Rules:

nonZero(0) → false
nonZero(s(z0)) → true
p(0) → 0
p(s(z0)) → z0
id_inc(z0) → z0
id_inc(z0) → s(z0)
random(z0) → rand(z0, 0)
rand(z0, z1) → if(nonZero(z0), z0, z1)
if(false, z0, z1) → z1
if(true, z0, z1) → rand(p(z0), id_inc(z1))
Tuples:

IF(true, x0, z0) → c9(RAND(p(x0), s(z0)), P(x0), ID_INC(z0))
IF(true, s(z0), x1) → c9(RAND(z0, id_inc(x1)), P(s(z0)), ID_INC(x1))
RAND(s(x0), x1) → c7(IF(true, s(x0), x1))
IF(true, s(z0), x1) → c9(RAND(z0, x1), P(s(z0)), ID_INC(x1))
S tuples:

IF(true, x0, z0) → c9(RAND(p(x0), s(z0)), P(x0), ID_INC(z0))
RAND(s(x0), x1) → c7(IF(true, s(x0), x1))
K tuples:

IF(true, s(z0), x1) → c9(RAND(z0, id_inc(x1)), P(s(z0)), ID_INC(x1))
IF(true, s(z0), x1) → c9(RAND(z0, x1), P(s(z0)), ID_INC(x1))
Defined Rule Symbols:

nonZero, p, id_inc, random, rand, if

Defined Pair Symbols:

IF, RAND

Compound Symbols:

c9, c7

(23) CdtNarrowingProof (BOTH BOUNDS(ID, ID) transformation)

Use narrowing to replace IF(true, x0, z0) → c9(RAND(p(x0), s(z0)), P(x0), ID_INC(z0)) by

IF(true, 0, x1) → c9(RAND(0, s(x1)), P(0), ID_INC(x1))
IF(true, s(z0), x1) → c9(RAND(z0, s(x1)), P(s(z0)), ID_INC(x1))
IF(true, x0, x1) → c9

(24) Obligation:

Complexity Dependency Tuples Problem
Rules:

nonZero(0) → false
nonZero(s(z0)) → true
p(0) → 0
p(s(z0)) → z0
id_inc(z0) → z0
id_inc(z0) → s(z0)
random(z0) → rand(z0, 0)
rand(z0, z1) → if(nonZero(z0), z0, z1)
if(false, z0, z1) → z1
if(true, z0, z1) → rand(p(z0), id_inc(z1))
Tuples:

IF(true, s(z0), x1) → c9(RAND(z0, id_inc(x1)), P(s(z0)), ID_INC(x1))
RAND(s(x0), x1) → c7(IF(true, s(x0), x1))
IF(true, s(z0), x1) → c9(RAND(z0, x1), P(s(z0)), ID_INC(x1))
IF(true, 0, x1) → c9(RAND(0, s(x1)), P(0), ID_INC(x1))
IF(true, s(z0), x1) → c9(RAND(z0, s(x1)), P(s(z0)), ID_INC(x1))
IF(true, x0, x1) → c9
S tuples:

RAND(s(x0), x1) → c7(IF(true, s(x0), x1))
IF(true, 0, x1) → c9(RAND(0, s(x1)), P(0), ID_INC(x1))
IF(true, s(z0), x1) → c9(RAND(z0, s(x1)), P(s(z0)), ID_INC(x1))
IF(true, x0, x1) → c9
K tuples:

IF(true, s(z0), x1) → c9(RAND(z0, id_inc(x1)), P(s(z0)), ID_INC(x1))
IF(true, s(z0), x1) → c9(RAND(z0, x1), P(s(z0)), ID_INC(x1))
Defined Rule Symbols:

nonZero, p, id_inc, random, rand, if

Defined Pair Symbols:

IF, RAND

Compound Symbols:

c9, c7, c9

(25) CdtLeafRemovalProof (BOTH BOUNDS(ID, ID) transformation)

Removed 2 trailing nodes:

IF(true, 0, x1) → c9(RAND(0, s(x1)), P(0), ID_INC(x1))
IF(true, x0, x1) → c9

(26) Obligation:

Complexity Dependency Tuples Problem
Rules:

nonZero(0) → false
nonZero(s(z0)) → true
p(0) → 0
p(s(z0)) → z0
id_inc(z0) → z0
id_inc(z0) → s(z0)
random(z0) → rand(z0, 0)
rand(z0, z1) → if(nonZero(z0), z0, z1)
if(false, z0, z1) → z1
if(true, z0, z1) → rand(p(z0), id_inc(z1))
Tuples:

IF(true, s(z0), x1) → c9(RAND(z0, id_inc(x1)), P(s(z0)), ID_INC(x1))
RAND(s(x0), x1) → c7(IF(true, s(x0), x1))
IF(true, s(z0), x1) → c9(RAND(z0, x1), P(s(z0)), ID_INC(x1))
IF(true, s(z0), x1) → c9(RAND(z0, s(x1)), P(s(z0)), ID_INC(x1))
S tuples:

RAND(s(x0), x1) → c7(IF(true, s(x0), x1))
IF(true, s(z0), x1) → c9(RAND(z0, s(x1)), P(s(z0)), ID_INC(x1))
K tuples:

IF(true, s(z0), x1) → c9(RAND(z0, id_inc(x1)), P(s(z0)), ID_INC(x1))
IF(true, s(z0), x1) → c9(RAND(z0, x1), P(s(z0)), ID_INC(x1))
Defined Rule Symbols:

nonZero, p, id_inc, random, rand, if

Defined Pair Symbols:

IF, RAND

Compound Symbols:

c9, c7

(27) CdtPolyRedPairProof (UPPER BOUND (ADD(O(n^1))) transformation)

Found a reduction pair which oriented the following tuples strictly. Hence they can be removed from S.

IF(true, s(z0), x1) → c9(RAND(z0, s(x1)), P(s(z0)), ID_INC(x1))
We considered the (Usable) Rules:

id_inc(z0) → z0
id_inc(z0) → s(z0)
And the Tuples:

IF(true, s(z0), x1) → c9(RAND(z0, id_inc(x1)), P(s(z0)), ID_INC(x1))
RAND(s(x0), x1) → c7(IF(true, s(x0), x1))
IF(true, s(z0), x1) → c9(RAND(z0, x1), P(s(z0)), ID_INC(x1))
IF(true, s(z0), x1) → c9(RAND(z0, s(x1)), P(s(z0)), ID_INC(x1))
The order we found is given by the following interpretation:
Polynomial interpretation :

POL(ID_INC(x1)) = 0   
POL(IF(x1, x2, x3)) = [4]x1 + [4]x2   
POL(P(x1)) = 0   
POL(RAND(x1, x2)) = [4]x1   
POL(c7(x1)) = x1   
POL(c9(x1, x2, x3)) = x1 + x2 + x3   
POL(id_inc(x1)) = [4]x1   
POL(s(x1)) = [4] + x1   
POL(true) = 0   

(28) Obligation:

Complexity Dependency Tuples Problem
Rules:

nonZero(0) → false
nonZero(s(z0)) → true
p(0) → 0
p(s(z0)) → z0
id_inc(z0) → z0
id_inc(z0) → s(z0)
random(z0) → rand(z0, 0)
rand(z0, z1) → if(nonZero(z0), z0, z1)
if(false, z0, z1) → z1
if(true, z0, z1) → rand(p(z0), id_inc(z1))
Tuples:

IF(true, s(z0), x1) → c9(RAND(z0, id_inc(x1)), P(s(z0)), ID_INC(x1))
RAND(s(x0), x1) → c7(IF(true, s(x0), x1))
IF(true, s(z0), x1) → c9(RAND(z0, x1), P(s(z0)), ID_INC(x1))
IF(true, s(z0), x1) → c9(RAND(z0, s(x1)), P(s(z0)), ID_INC(x1))
S tuples:

RAND(s(x0), x1) → c7(IF(true, s(x0), x1))
K tuples:

IF(true, s(z0), x1) → c9(RAND(z0, id_inc(x1)), P(s(z0)), ID_INC(x1))
IF(true, s(z0), x1) → c9(RAND(z0, x1), P(s(z0)), ID_INC(x1))
IF(true, s(z0), x1) → c9(RAND(z0, s(x1)), P(s(z0)), ID_INC(x1))
Defined Rule Symbols:

nonZero, p, id_inc, random, rand, if

Defined Pair Symbols:

IF, RAND

Compound Symbols:

c9, c7

(29) CdtKnowledgeProof (EQUIVALENT transformation)

The following tuples could be moved from S to K by knowledge propagation:

RAND(s(x0), x1) → c7(IF(true, s(x0), x1))
IF(true, s(z0), x1) → c9(RAND(z0, id_inc(x1)), P(s(z0)), ID_INC(x1))
IF(true, s(z0), x1) → c9(RAND(z0, x1), P(s(z0)), ID_INC(x1))
IF(true, s(z0), x1) → c9(RAND(z0, s(x1)), P(s(z0)), ID_INC(x1))
Now S is empty

(30) BOUNDS(O(1), O(1))